package com.itbuka.goods.mapper;

import com.itbuka.goods.domain.GoodsProductDetails;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface GoodsProductDetailsMapper extends BaseMapper<GoodsProductDetails> {

    @Update("update goods_product_details set inventory =inventory-#{num} where id = #{productId} and inventory >= #{num}")
    Integer reduceStock(@Param("productId") Long productId, @Param("num") Integer num);
}




